Fix #2687: correct postfix completion text when selected by mouse click - #3851
Fix #2687: correct postfix completion text when selected by mouse click#3851MeherSru wants to merge 1 commit into
Conversation
… by mouse click Postfix templates (sysout, syserr, etc.) computed their real text and replacement range lazily, only during completionItem/resolve. Clients that skip resolve on mouse-click (e.g. VS Code) inserted the unresolved placeholder text instead. Postfix completion now always computes the final text eagerly and anchors its edit the same way other completion items do, so behavior no longer depends on resolve being called. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Sorry, I should have looked into this issue a bit more before asking you to look into it. I read through #2687 and microsoft/vscode#183092, and it seems pretty messy. The main problem with the approach you took here (removing resolve for postfix completions) appears to be that resolve was added for postfix completion in the first place because calculating the completion was having a noticeable performance impact. Even though this will fix the completion, this change will also reintroduce the performance issue. There was some discussion upstream from the VS Code team about providing some alternative solution for resolving the completion properly in a way that doesn't break the spec. However, it looks like there's been no movement upstream. I tend to believe that it's better for the completion results to be correct than to save a bit of time. I'll ask the folks from Microsoft who first implemented resolve for postfix completions what they think in the original issue, and if they've heard anything else about https://github.com/microsoft/vscode/issue |
sysout, syserr and the other postfix suggestions only built the
actual code when the editor asked for it in a separate step (resolve).
VS Code skips that step when you click with the mouse, so clicking
inserted broken placeholder text instead. Now the actual code is
ready right away, so clicking works the same as pressing Enter.